from counterpoint.models import Forum, ForumUser
from django.conf.urls.defaults import *
from django.views.generic import list_detail


forum_dict = {'queryset': Forum.objects.all(), 'allow_empty': True}
forumuser_dict = {'queryset': ForumUser.objects.all()}


urlpatterns = patterns('',

    url(r'^$',
            list_detail.object_list, forum_dict, name='cp_index'),

    url(r'^user/(?P<object_id>\d+)/$',
            list_detail.object_detail, forumuser_dict, name='cp_userdetail'),
)


urlpatterns += patterns('counterpoint.views',

    url(r'^frm/(?P<forum_id>\d+)/$',
            'forum_index', name='cp_forum'),

    url(r'^frm/(?P<forum_id>\d+)/page/(?P<page>)/$',
            'forum_index', name='cp_forum_page'),

    url(r'^frm/(?P<forum_id>\d+)/new/$',
            'new_post', name='cp_newpost'),

    url(r'^frm/(?P<forum_id>\d+)/tpc/(?P<thread_id>\d+)/$',
            'thread_view', name='cp_thread'),

    url(r'^frm/(?P<forum_id>\d+)/tpc/(?P<thread_id>\d+)/page/(?P<page>)/$',
            'thread_view', name='cp_thread_page'),

    url(r'^frm/(?P<forum_id>\d+)/tpc/(?P<thread_id>\d+)/reply/$',
            'new_post', name='cp_reply'),

    url(r'^edit/(?P<post_id>\d+)/$',
            'edit', name='cp_edit'),

    url(r'^user/(?P<user_id>\d+)/edit/$',
            'edit_user', name='cp_useredit'),

    url(r'^cpadmin/', include('counterpoint.urls.admin')),
)
